Skip to content

Add support for partitioned (CHIPS) cookies#572

Open
alex-gutev wants to merge 3 commits intovimalloc:mainfrom
alex-gutev:partitioned-cookies
Open

Add support for partitioned (CHIPS) cookies#572
alex-gutev wants to merge 3 commits intovimalloc:mainfrom
alex-gutev:partitioned-cookies

Conversation

@alex-gutev
Copy link
Copy Markdown

This PR introduces support for the Partitioned attribute in cookies generated by flask-jwt-extended.

As browsers move toward deprecating third-party cookies, the CHIPS standard allows cookies to be set in "partitioned" storage using a new jar per top-level site. This is specifically required when the authentication server (API) resides on a different domain than the client application. Partitioned cookies prevent cross-site tracking while allowing functional cross-site needs like authentication.

The Problem

Without the Partitioned attribute, browsers are beginning to surface the following warning (and will eventually block the cookie entirely), when the authentication server resides on a different domain than the client application:

Cookie ‘access_token_cookie’ will soon be rejected because it is foreign and does not have the ‘Partitioned’ attribute.

Changes

  • Added JWT_COOKIE_PARTITIONED configuration variable (defaults to False).

  • Updated set_access_cookies and set_refresh_cookies to include the partitioned parameter when calling set_cookie.

@vimalloc
Copy link
Copy Markdown
Owner

It looks like there are a couple lint errors, and tokens.py needs to be updated as well, but overall looks good! Thank you for submitting the PR. I'll get a new release cut once everything gets resolved and this gets merged! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants